package coroutines

import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

fun main() = runBlocking {
    val job = GlobalScope.launch { testJoin() }

    for (i in 1..500) {
        if (i == 200) {
            job.join()
        }
        println("排队---$i")
    }

    val line = readLine()
    println(line)
}

private fun testJoin() {
    for (i in 1..200) {
        println("协程vip来了$i")
    }
}